using System;
using System.Collections.Generic;

namespace Charisma.Tests.Models.BlogApp
{
  public static class DataGenerator
  {
    public static Post GeneratePost()
    {
      var result = new Post {
          Title = "Post title",
          Date = DateTime.Now,
          Comments = GenerateComments(3),
          Content = "post content",
          Tags = new List<string>
            {
              "News",
              "Announcement"
            }
        };

      return result;
    }

    public static IList<Comment> GenerateComments(int number)
    {
      var result = new List<Comment>();
      for (int i = 0; i < number; i++) {
        var comment = new Comment {
            Author = GenerateAuthor(i),
            Date = DateTime.Now.AddHours(-1*(i + 1)),
            Content = "Comment content " + i
          };
        result.Add(comment);
      }
      return result;
    }

    public static Author GenerateAuthor(int id)
    {
      return new Author
        {
          Id = "0001212",
          FirstName = "Joel",
          LastName = "Spolsky",
          Contacts = new ContactInfo{Email = "joel.spolsky@gmail.com", Phone = "3101010:" + id},
          Nickname = "Joel"
        };
    }
  }
}